<template>
  <div>
    <Header :sightName="sightName"></Header>
    <Banner :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></Banner>
    <!-- 增加滚动空间 -->
    <div class="content">
      <DetailList :categoryList="categoryList"></DetailList>
    </div>
  </div>
</template>

<script>
import axios from "axios";
import Banner from "./components/Banner.vue";
import Header from "./components/Header.vue";
import DetailList from "./components/List.vue";
export default {
  name: "Detail",
  components: { Banner, Header, DetailList },
  data() {
    return {
      sightName: "",
      bannerImg: "",
      gallaryImgs: [],
      categoryList: []
    };
  },
  methods: {
    getDetailInfo() {
      axios
        .get("/api/detail.json",{
          params:{
            id:this.$route.params.id
          }
        })
        .then(res => {
          const info = res.data.data;
          this.sightName = info.sightName;
          this.bannerImg = info.bannerImg;
          this.gallaryImgs = info.gallaryImgs;
          this.categoryList = info.categoryList;
        })
        .catch(err => {
          console.log(err.message);
        });
    }
  },
  mounted() {
    this.getDetailInfo();
  }
};
</script>

<style lang="less" scoped>
.content {
  height: 40rem;
}
</style>
